<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>登录</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<!--标准mui.css-->
		<link rel="stylesheet" href="../css/mui.min.css">
		<link rel="stylesheet" href="../css/common.css" />
		<style>
			* {
				margin: 0px;
				padding: 0px;
			}
			body {
				background-color: #FFFFFF;
			}
			.mui-content {
				background-color: #FFFFFF;
			}
			.login-info {
				margin: 45px 10px 0px 10px;
			}
			.item-input {
				width: 100%;	
			}
			input[type=text] {
				margin-bottom: 0px;
				padding: 0px;
			}
			input[type=password] {
				margin-bottom: 0px;
				padding: 0px;
			}
			.item-input img{
				height: 24px;
				vertical-align: middle;
			}
			.input-border {
				width: 85%;
				display: inline-block;
				position: relative;
				margin-bottom: 20px;
				margin-left: 10px;
				border-bottom: 1px solid #D9D8D9;
			}
			.input-border input {
				display: inline-block;
				width: 60%;
				vertical-align: middle;
				background-color: transparent;
				border: none;
				box-shadow: none;
				font-size: 16px;
				color: #666666;
			}
			.division-span {
				line-height: 40px;
				font-size: 20px;
				color: #CCCCCC;
			}
			.tips-span {
				height: 40px;
				margin-left: 50%;
				font-family: 'PingFangSC-Regular';
				font-size: 16px;
				color: #5BA9F9;
				border-width: 0px;
			}
			.code-div {
				display: inline-block;
				float: right;
			}
			.login-button {
				margin-top: 50px;
				text-align: center;
			}
			.confirm-btn {
				width: 300px;
				height: 45px;
				background: #5BA9F9;
				border-radius: 4px;
				font-size: 20px;
				color: #FFFFFF;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">融弈签</h1>
		</header>
		<div class="mui-content">
			<div class="login-info">
				<div class="item-input">
					<img src="../img/applicant/phone_icon.png" />
					<div class="input-border">
						<input type="text" id="phone" class="form-control" placeholder="请输入手机号">
					</div>
				</div>
				<div class="item-input">
					<img src="../img/applicant/defense_icon.png" />
					<div class="input-border">
						<input type="password" id="password" class="form-control" placeholder="请输入密码">
					</div>
				</div>
				<button class="tips-span" onclick="goRegView()">没有帐号？点此注册</button>
				<div class="login-button">
					<button type="button" class="confirm-btn">登&nbsp;&nbsp;录</button>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../js/thirdparty/jquery-3.3.1.js" ></script>
	<script type="text/javascript" src="../js/thirdparty/mui.min.js" ></script>
	<script type="text/javascript" src="../js/thirdparty/spin.min.js" ></script>
	<script type="text/javascript" src="../js/utils/regular.js"></script>
	<script type="text/javascript" src="../js/utils/boot.js?version=1" ></script>
	<script type="text/javascript">
		var userID = base.getParameter("userID");
		$(function() {
			var data = localStorage.getItem('loginData');
			if(data) {
				$("#phone").val(JSON.parse(data).phone);
				$("#password").val(JSON.parse(data).password)
			}
		})
		function goRegView() {
			window.location.href = "regPhone.html";
		}
		$('.login-button').on('tap', 'button', function() {
			base.setWait("正在登录...");
			var url = base.url.customerLogin;
			var data = {
				phone:$("#phone").val(),
				password : $("#password").val(),
			};
			localStorage.setItem('loginData', JSON.stringify(data));
			base.postData(url,data,customerLoginSuccess);
		})
		function customerLoginSuccess(data) {
			if(data.success) {
				mui.toast(data.message);
				var isWechat = base.isOnWx();
				sessionStorage.setItem('headImg', data.extendData.headImg);
				sessionStorage.setItem("customerName", data.extendData.customerName);
				if (isWechat) {
					//微信浏览器进授权
					window.location.href = server_host+'wx/authorize?backUrl='+ root_host+'ry_visa_web/pages/homePage.html?customerId='+data.extendData.customerId+'&phone='+$("#phone").val();	
				}else{
					window.location.href = "homePage.html?customerId="+data.extendData.customerId;	
				}
			} else {
				mui.toast(data.message);
			}
		}
	</script>
</html>